package b6.vacancyshare.activity;

import b6.vacancyshare.R;
import b6.vacancyshare.database.DBPengguna;
import b6.vacancyshare.database.DBUserAdapter;
import android.app.Activity;
import android.content.Intent;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MenuLogin extends Activity {
	TextView signUp;
	Button loginButton;
	
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        
        final TextView txtUsername = (TextView) findViewById(R.id.UsernameTFLogin);
        final TextView txtPassword = (TextView) findViewById(R.id.PasswordTFLogin);
        signUp = (TextView)findViewById(R.id.Signup);
        loginButton = (Button)findViewById(R.id.LoginButton);
        final Intent route1 = new Intent(this, b6.vacancyshare.activity.MenuDaftar.class);
		final Intent route2 = new Intent(this, b6.vacancyshare.activity.MenuUtama.class);
        
        signUp.setOnClickListener(new View.OnClickListener() {

			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				startActivity(route1);
			}
        	
        });
        
        loginButton.setOnClickListener(new View.OnClickListener() {
			
        	public void onClick(View v) {
				// TODO Auto-generated method stub
				startActivity(route2);
        		/*String username = txtUsername.getText().toString();
				String password = txtPassword.getText().toString();
				try{
					if(username.length() > 0 && password.length() >0)
					{
						DBUserAdapter dbUser = new DBUserAdapter(MenuLogin.this);
						dbUser.open();
						
						
						if(dbUser.Login(username, password))
						{
							Toast.makeText(MenuLogin.this,"Successfully Logged In", Toast.LENGTH_LONG).show();
							Intent i = new Intent(MenuLogin.this, MenuDaftar.class);
							startActivity(i);
						}else{
							Toast.makeText(MenuLogin.this,"Invalid Username/Password", Toast.LENGTH_LONG).show();
						}
						dbUser.close();
					}
					
				}catch(Exception e)
				{
					Toast.makeText(MenuLogin.this,e.getMessage(), Toast.LENGTH_LONG).show();
				}*/
			}
		});
     }
}